﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BusinessTier
{
    public class PlayerService
    {
        private IDictionary<string, Player> players = new Dictionary<string, Player>();

        public Player getPlayer(string username)
        {
            if (players.ContainsKey(username))
            {
                return players[username];
            }
            else
            {
                return null;
            }
        }

        public Player createPlayer(string username, MazeServer game)
        {
            if (players.ContainsKey(username))
            {
                return getPlayer(username);
            }
            else
            {
                Player newPlayer = new Player(username, game.Id);
                players.Add(username, newPlayer);
                return newPlayer;
            }
        }
    }
}
